//#include "stdafx.h"

#include <windows.h>
//#include "CColladaConverter.h"
//#include "CColladaDatabase.h"

#include "PFExporter.h"
#include "SceneIlluminationMap.h"
#include "IlumpUtils.h"

#include "CGlobals.h"
extern CGlobals* g;
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
int PFExporter::s_TileSize=100;
int PFExporter::s_TileSizeZ=100;
int PFExporter::s_MinValue = 0;
int PFExporter::s_MaxValue = 255;
int PFExporter::s_Offset = 0;
float PFExporter::s_scaleR = 1.0f;
float PFExporter::s_scaleG = 1.0f;
float PFExporter::s_scaleB = 1.0f;

std::vector<RoomMapInfo*> PFExporter::s_roomMaps;

RoomMapInfo::~RoomMapInfo()
{
	for(int i=0; i<collision_num; ++i)
		delete collision_array[i];
	delete[] collision_array;
	collision_array = 0;
}

void RoomMapInfo::PreCompute(irr::scene::ISceneNode* RoomRootNode)
{
	//Node = RoomRootNode;
	//
	//AABBox = RoomRootNode->getBoundingBox();
	//
	//// create mesh collisions from geometry
	//
	//collision_array = 0;
	//Utils::CreateMeshCollisionArray(RoomRootNode, collision_array, collision_num);
	//collision_array = NEW CAdvancedMeshCollision*[collision_num];
	//collision_num = 0;
	//Utils::CreateMeshCollisionArray(RoomRootNode, collision_array, collision_num);
}

void PFExporter::ExportIlluminationMap(irr::scene::ISceneManager* smgr, RoomMapInfo& info, int tileSize, int tileSizeZ)
{						
	//smgr->getRootSceneNode()->addChild(info.Node);
	////Utils::CleanDummies(root, root);
	//Utils::ComputeBoundingBox(info.Node);
	//Utils::ReadAllLightmapTextures(smgr->getRootSceneNode());
	//
	//
	////parse/create the lightmap
	//SceneIlluminationMap lightMap;
	//lightMap.Compute(info, tileSize, tileSizeZ);

	//irr::io::IWriteFile* file = g->device->getFileSystem()->createAndWriteFile( info.FileName.c_str() );

	//lightMap.SaveBinary(*file);
	//file->drop();

	//lightMap.SaveAscii("LightMap.txt");
		

	
}

